﻿@model IEnumerable<CodeAbility.MonitorAndCommand.Models.Event>

<table id="DataTable" style="width: 100%;">
    <!-- Header -->
    <tr>
        <th>
            Device
        </th>
        <th>
            Content
        </th>
        <th>
            Timestamp
        </th>
    </tr>

    <!-- Items -->
    @foreach (var item in Model)
    {
        var cssClass = String.Empty;

        if (item.Content.Contains("Listening"))
        {
            cssClass = "listening";
        }
        else if (item.Content.Contains("unregistered"))
        {
            cssClass = "unregistered";
        }
        else if (item.Content.Contains("registered"))
        {
            cssClass = "registered";
        }
        else
        {
            cssClass = "default";
        }       
        
    <tr class="@cssClass">
        <td class="nowarp">
            @Html.DisplayFor(modelitem => item.FromDevice)
        </td>
        <td>
            @Html.DisplayFor(modelitem => item.Content)
        </td>
        <td class="nowarp">
            <a href="#" data-toggle="timestamp" data-placement="top" title="@item.Timestamp.ToString("dd/MM/yyyy HH:mm:ss.fff")">
                @item.Timestamp.ToString("dd/MM/yyyy HH:mm:ss.fff") <!-- "hh:mm:ss.fff tt" -->
                @*@Html.DisplayFor(modelitem => item.Timestamp)*@
            </a>
        </td>
    </tr>
    }
</table>

<br />
@*@Html.ActionLink("Purge", "Purge", "Event")*@